package com.youdianda.controller.admin;

import com.baomidou.mybatisplus.extension.api.R;
import com.youdianda.dto.SysMenuUpdateDTO;
import com.youdianda.result.Result;
import com.youdianda.service.SysMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 菜单管理
 */
@RestController
@Api(tags = "菜单管理接口")
@RequestMapping("/sys_menu")
@Slf4j
public class SysMenuController {
    @Autowired
    private SysMenuService sysMenuService;

    /**
     * 菜单修改
     *
     * @return
     */
    @PostMapping("/update")
    @ApiOperation("菜单修改")
    public Result update(@RequestBody SysMenuUpdateDTO sysMenuUpdateDTO) {
        sysMenuService.update(sysMenuUpdateDTO);
        return Result.success();
    }

    /**
     * 菜单删除
     * @param id
     * @return
     */
    @GetMapping("/del")
    @ApiOperation("菜单删除")
    public Result del(String id){
        sysMenuService.del(id);
        return Result.success();
    }

}
